{% from "components/macros/layout.html" import card, resource_bar, stats_strip %}
{% from "pages/overseer/_macros.html" import status_card %}
{% set meta = component.metadata or {} %}
{% set deprecated = meta.get("deprecated_count") or 0 %}
{% for key, label in [("cpu", "CPU"), ("memory", "Memory"), ("disk", "Disk")] %}
{% set metric = component.sub_components.get(key) %}
{% set data = metric.metadata if metric else {} %}
{% set detail = "" %}
{% if key == "cpu" and data.get("cpu_count") %}
{% set detail = data.cpu_count ~ " logical cores" %}
{% elif key == "memory" and data.get("total_gb") is number and data.get("available_gb") is number %}
{% set detail = "%.1f GB used of %.1f GB"|format(data.total_gb - data.available_gb, data.total_gb) %}
{% elif key == "disk" and data.get("total_gb") is number and data.get("free_gb") is number %}
{% set detail = "%.1f GB free of %.1f GB"|format(data.free_gb, data.total_gb) %}
{% endif %}
{{ resource_bar(label, metric, detail) }}
{% endfor %}
{% endcall %}
{{ status_card(component, "backend", [("HTTP methods", methods or "-")]) }}